#ifndef __Z_MODULE_H__
#define __Z_MODULE_H__

#ifdef _WINDOWS
#	ifdef CHECK_MODULE_EXPORTS
#		define CHECK_MODULE_API __declspec(dllexport)
#	else
#		define CHECK_MODULE_API __declspec(dllimport)
#	endif
#else
#	define CHECK_MODULE_API
#endif

#include "zCore.h"

namespace ck
{
	class Module;
	class Operator;
	class OpInput;
	class Output;
	class OpRule;
	class Argument;
	class Value;
	class Constraint;

	namespace check 
	{
		class CheckResult;
	};
	
	//class Argument
	//{
	//protected:
	//	Argument(){}
	//	virtual ~Argument(){}
	//public:
	//	virtual	const char*	GetKey() = 0;
	//	virtual Value*		GetValue() = 0;
	//};

	//class Input
	//{
	//protected:
	//	Input() {}
	//	virtual ~Input() {}
	//public:
	//	virtual z_uint32	GetArgCount() = 0;
	//	virtual Argument*	GetArgument(z_uint32 i) = 0;

	//};

	//class Rule
	//{
	//protected:
	//	Rule() {}
	//	virtual ~Rule() {}
	//public:
	//	virtual z_uint32	GetConstraintCount() = 0;
	//	virtual Constraint*	GetConstraint(z_int32 i) = 0;

	//	virtual Constraint*	Create() = 0;
	//	virtual RESULTCODE	Add(Constraint* pConstraint) = 0;

	//};

	//class Constraint
	//{
	//protected:
	//	Constraint(){}
	//	virtual ~Constraint(){}

	//public:
	//	virtual const char*	GetKey() = 0;		
	//	virtual Value*		GetValue() = 0;
	//	virtual RESULTCODE	SetValue(Value* pValue) = 0;
	//	virtual z_uint32	GetComparision() = 0;
	//	virtual void		SetComparision(z_uint32 cmpr) = 0;

	//};

	class Output
	{
	protected:
		Output() {}
		virtual ~Output() {}
	public:
	};

	class Operator
	{
	protected:
		Operator() {}
		virtual ~Operator() {}
	public:
		virtual OpInput*	GetInput() = 0;
		virtual Output*		GetOutput() = 0;
		virtual OpRule*		GetRule() = 0;

		//------------------------------------------------------------------------
		virtual RESULTCODE	Run() = 0;

		virtual void		SetParameter(z_uint32 i, void* pParam) = 0;
		virtual z_uint32	GetParameterCount() = 0;
		virtual check::CheckResult* GetResult() = 0;;
		//------------------------------------------------------------------------
		virtual const char*	GetID() = 0;
		virtual const char*	GetName() = 0;
		virtual z_uint32	GetCode() = 0;
		virtual const char*	GetDescription() = 0;
		virtual const char* GetModuleName() = 0;

		virtual bool		IsManual() = 0;

		virtual Module*		GetModule() = 0;
	};

	class Module
	{
	protected:
		Module(){}
		virtual ~Module(){}

	public:
		virtual const char* GetID() = 0;
		virtual z_uint32	GetCode() = 0;
		virtual const char* GetName() = 0;
		//virtual const char* GetModuleName() = 0;
		virtual const char*	GetDeveloper() = 0;
		virtual const char* GetDescription() = 0;

		virtual void		SetHandler(void* ptr) = 0;

	public:
		virtual z_uint32	GetOperatorCount() = 0;
		virtual Operator*	GetOperator(z_uint32 i) = 0;

		virtual Operator*	GetOperatorByCode(z_uint32 code) = 0;
	};
}

extern "C"
{
	CHECK_MODULE_API ck::Module* ckGetCheckModuleInstance();

	CHECK_MODULE_API int RasterClip(const char* szRasterPath, const char* szFeaturePath);
}

//typedef Module* (*fcGetCheckModuleInstancePtr)();


#endif //__Z_MODULE_H__
